//microcommand define checkin
inject(["database", "monetary"])
signature("", { maxUsage: 1 })
action(async ({ root, session }) => {
const reward = Random.int(10, 21)
await ctx.monetary.gain(session.user.id, reward)
const [data] = await ctx.database.get("monetary", { uid: session.user.id, currency: "default" }, ["value"])
const value = data?.value ?? reward
const res = session.i18n(".success", { reward, value })
if (root && !session.isDirect) res.unshift(h.quote(session.messageId))
return res
})
locale("zh-CN", { description: "签到", messages: { success: "签到成功，获得 {reward} 点数，当前点数为 {value}。" } })